#ifndef CLOCK_DEFAULTSTATE_HPP
#define CLOCK_DEFAULTSTATE_HPP

#include "State.hpp"
#include "../TweenObjects.hpp"
#include "../TopInformations.hpp"
#include "../ClockItem.hpp"
#include "../Calendar.hpp"
#include "../IconSet.hpp"
#include "../Stopwatch.hpp"
#include "../Timer.hpp"
#include "../Alarm.hpp"
#include <cpp3ds/Graphics/Sprite.hpp>
#include <cpp3ds/Graphics/Texture.hpp>
#include <cpp3ds/System/Clock.hpp>
#include <cpp3ds/Graphics/RectangleShape.hpp>
#include <TweenEngine/TweenManager.h>
#include <cpp3ds/Audio/SoundBuffer.hpp>
#include <cpp3ds/Audio/Sound.hpp>
#include <cpp3ds/Audio/Music.hpp>

namespace Clock {

class DefaultState : public State
{
public:
	DefaultState(StateStack& stack, Context& context, StateCallback callback);
	~DefaultState();

	virtual void renderTopScreen(cpp3ds::Window& window);
	virtual void renderBottomScreen(cpp3ds::Window& window);
	virtual bool update(float delta);
	virtual bool processEvent(const cpp3ds::Event& event);

private:
	enum Mode {
		Mode_None = 0,
		Mode_Stopwatch,
		Mode_Timer,
		Mode_Alarm,
	};

	void setMode(Mode mode);

	TopInformations m_topInfos;
	ClockItem m_clock;
	Calendar m_calendar;

	Stopwatch m_stopwatch;
	Timer m_timer;
	Alarm m_alarms;

	IconSet m_iconSet;

	// Transitioning
	bool m_isTransitioning;
	Mode m_mode;
	util3ds::TweenRectangleShape m_whiteScreen;
	util3ds::TweenableView m_bottomView;

	TweenEngine::TweenManager m_tweenManager;
};

extern DefaultState *g_defaultState;

} // namespace Clock

#endif // CLOCK_DEFAULTSTATE_HPP
